﻿using MediatR;
using T_Rbac_APi.Application.Command.Rule;
using T_Rbac_Rep.Interface;

namespace T_Rbac_APi.Application.CommandHandler.RuleHandler
{
    public class RuleDeleteHandler : IRequestHandler<RuleDeleteCommand, int>
    {
        private readonly IRuleInformation ruleInformation;

        public RuleDeleteHandler(IRuleInformation ruleInformation)
        {
            this.ruleInformation = ruleInformation;
        }

        public async Task<int> Handle(RuleDeleteCommand request, CancellationToken cancellationToken)
        {
            var id=request.id;
            var list=await ruleInformation.GetAloneByid(id);
            list.IsDel=true;
            return await ruleInformation.Update(list);
        }
    }
}
